$slider_size: $scalable_icon_size;
.slider {
+ color: if($variant == 'light', $fg_color, darken($fg_color, 9%));
+
// slider trough
-barlevel-height: 4px;
- -barlevel-background-color: transparentize($fg_color, 0.8); //background of the trough
- -barlevel-border-width: 2px;
- -barlevel-border-color: transparent; // trough border color
+ -barlevel-background-color: transparentize($fg_color, 0.9);
// fill style
-barlevel-active-background-color: $selected_bg_color;
- -barlevel-active-border-color: transparent;
// overfill style (red in this case)
-barlevel-overdrive-color: $destructive_color;
- -barlevel-overdrive-border-color: transparent; //trough border when red;
-barlevel-overdrive-separator-width:1px;
// slider handler
-slider-handle-radius: $slider_size * 0.5; // half the size of the size
- -slider-handle-border-width: 0;
- -slider-handle-border-color: transparent; // because 0 width
- // hc style
- @if $contrast == 'high' {
- -barlevel-background-color: transparentize($fg_color, 0.6);
- }
+ // hc style
+ @if $contrast == 'high' {
+ -barlevel-background-color: transparentize($fg_color, 0.6);
+ }
+
+ &:hover {
+ color: if($variant == 'light', lighten($fg_color, 7%), $fg_color);
+ }
}
this._barLevelWidth = 0;
this._barLevelHeight = 0;
- this._barLevelBorderWidth = 0;
this._overdriveSeparatorWidth = 0;
this._barLevelColor = null;
this._barLevelActiveColor = null;
this._barLevelOverdriveColor = null;
- this._barLevelBorderColor = null;
- this._barLevelActiveBorderColor = null;
- this._barLevelOverdriveBorderColor = null;
super._init({
style_class: 'barlevel',
const themeNode = this.get_theme_node();
this._barLevelHeight = themeNode.get_length('-barlevel-height');
- this._barLevelBorderWidth =
- Math.min(themeNode.get_length('-barlevel-border-width'), this._barLevelHeight);
this._overdriveSeparatorWidth =
themeNode.get_length('-barlevel-overdrive-separator-width');
this._barLevelColor = themeNode.get_color('-barlevel-background-color');
this._barLevelActiveColor = themeNode.get_color('-barlevel-active-background-color');
this._barLevelOverdriveColor = themeNode.get_color('-barlevel-overdrive-color');
-
- const [hasBorderColor, barLevelBorderColor] =
- themeNode.lookup_color('-barlevel-border-color', false);
- this._barLevelBorderColor = hasBorderColor
- ? barLevelBorderColor : this._barLevelColor;
-
- const [hasActiveBorderColor, barLevelActiveBorderColor] =
- themeNode.lookup_color('-barlevel-active-border-color', false);
- this._barLevelActiveBorderColor = hasActiveBorderColor
- ? barLevelActiveBorderColor : this._barLevelActiveColor;
-
- const [hasOverdriveBorderColor, barLevelOverdriveBorderColor] =
- themeNode.lookup_color('-barlevel-overdrive-border-color', false);
- this._barLevelOverdriveBorderColor = hasOverdriveBorderColor
- ? barLevelOverdriveBorderColor : this._barLevelOverdriveColor;
}
vfunc_repaint() {
const overdriveSeparatorWidth = overdriveActive
? this._overdriveSeparatorWidth : 0;
- let xcArcStart = barLevelBorderRadius + this._barLevelBorderWidth;
+ let xcArcStart = barLevelBorderRadius;
let xcArcEnd = width - xcArcStart;
if (rtl)
[xcArcStart, xcArcEnd] = [xcArcEnd, xcArcStart];
cr.lineTo(xcArcEnd, (height - this._barLevelHeight) / 2);
cr.setSourceColor(this._barLevelColor);
cr.fillPreserve();
- cr.setSourceColor(this._barLevelBorderColor);
- cr.setLineWidth(this._barLevelBorderWidth);
- cr.stroke();
+ cr.fill();
/* normal progress bar */
let x = 0;
if (this._value > 0)
cr.setSourceColor(this._barLevelActiveColor);
cr.fillPreserve();
- cr.setSourceColor(this._barLevelActiveBorderColor);
- cr.setLineWidth(this._barLevelBorderWidth);
- cr.stroke();
+ cr.fill();
/* overdrive progress barLevel */
if (!rtl)
cr.lineTo(x, (height - this._barLevelHeight) / 2);
cr.setSourceColor(this._barLevelOverdriveColor);
cr.fillPreserve();
- cr.setSourceColor(this._barLevelOverdriveBorderColor);
- cr.setLineWidth(this._barLevelBorderWidth);
- cr.stroke();
+ cr.fill();
}
/* end progress bar arc */
}
cr.lineTo(endX, (height - this._barLevelHeight) / 2);
cr.fillPreserve();
- cr.setLineWidth(this._barLevelBorderWidth);
- cr.stroke();
}
/* draw overdrive separator */
}
_getPreferredHeight() {
- return this._barLevelHeight + this._barLevelBorderWidth;
+ return this._barLevelHeight;
}
_getPreferredWidth() {
- return this._overdriveSeparatorWidth + this._barLevelBorderWidth;
+ return this._overdriveSeparatorWidth;
}
_getCurrentValue() {
style_class: 'slider',
can_focus: true,
reactive: true,
+ track_hover: true,
+ hover: false,
accessible_role: Atk.Role.SLIDER,
x_expand: true,
});
this._dragging = false;
this._handleRadius = 0;
- this._handleBorderWidth = 0;
- this._handleBorderColor = null;
this._customAccessible.connect('get-minimum-increment', this._getMinimumIncrement.bind(this));
}
const themeNode = this.get_theme_node();
this._handleRadius = themeNode.get_length('-slider-handle-radius');
- this._handleBorderWidth =
- themeNode.get_length('-slider-handle-border-width');
- const [hasHandleColor, handleBorderColor] =
- themeNode.lookup_color('-slider-handle-border-color', false);
- this._handleBorderColor = hasHandleColor ? handleBorderColor : null;
}
vfunc_repaint() {
let [width, height] = this.get_surface_size();
const rtl = this.get_text_direction() === Clutter.TextDirection.RTL;
- const ceiledHandleRadius = Math.ceil(this._handleRadius + this._handleBorderWidth);
+ const ceiledHandleRadius = Math.ceil(this._handleRadius);
const handleY = height / 2;
let handleX = ceiledHandleRadius +
cr.setSourceColor(color);
cr.arc(handleX, handleY, this._handleRadius, 0, 2 * Math.PI);
cr.fillPreserve();
- if (this._handleBorderColor && this._handleBorderWidth) {
- cr.setSourceColor(this._handleBorderColor);
- cr.setLineWidth(this._handleBorderWidth);
- cr.stroke();
- }
cr.$dispose();
}
_getPreferredHeight() {
const barHeight = super._getPreferredHeight();
- const handleHeight = 2 * this._handleRadius + this._handleBorderWidth;
+ const handleHeight = 2 * this._handleRadius;
return Math.max(barHeight, handleHeight);
}
_getPreferredWidth() {
const barWidth = super._getPreferredWidth();
- const handleWidth = 2 * this._handleRadius + this._handleBorderWidth;
+ const handleWidth = 2 * this._handleRadius;
return Math.max(barWidth, handleWidth);
}